package com.yngk.tuyou;

import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import javax.jws.WebService;

@WebService(endpointInterface = "com.yngk.tuyou.FirstWs", serviceName = "firstWs")
public class FirstWsImpl implements FirstWs {

	Map<Integer, User> users = new HashMap<Integer, User>();
	
	@Override
	public String sayHi(String name) {
		
		System.out.println("调用sayHi方法");
		return "Hello " + name;
	}

	@Override
	public String sayHiToUser(User user) {
		
		System.out.println("调用sayHiToUser方法");
		users.put(user.getId(), user);
		return null;
	}

	@Override
	public Map<Integer, User> getUsers() {
		
		System.out.println("调用getUsers方法" + users);
		return users;
	}

	@Override
	public List<User> getUserList() {
		
		System.out.println("调用getUesrList方法" + users);
		Collection<User> collection = users.values();
		List<User> us = new LinkedList<User>();
		for(User user : collection){
			
			us.add(user);
		}
		return us;
	}

	
}
